package com.yiaik.app.service;

import com.yiaik.base.bean.ResUser;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.concurrent.atomic.AtomicLong;

@Service
@Slf4j
public class UserService {
    private AtomicLong counter = new AtomicLong();

    public UserService() {
        log.info("init: {}", UserService.class);
    }

    public ResUser login(ResUser user) {
        return ResUser.builder().id(counter.incrementAndGet()).sex(1).username(user.getUsername()).build();
    }

    public ResUser register(ResUser user) {
        return ResUser.builder().username(user.getUsername()).build();
    }
}
